<?php
namespace Home\Controller;
use Think\Controller;
import("Common.Common.Tools");
class IndexController extends Controller {

    function index(){
        $article=D('Article');
        $num=$article->count();
        $page=getpage($num,5);
        $info=$article->order('id desc')->limit($page->firstRow,$page->listRows)->select();
        $i=0;
        while($info["$i"]!==null){
            $info["$i"]['content'] = strip_tags($info["$i"]['content']);
            $i++;
        }

        $this->assign('info',$info);
        $show=$page->show();
        $this->assign('page',$show);

        $diary=D('Diary');
        $diary_info=$diary->order('id desc')->limit(10)->select();
        for($i=0;$i<$num;$i++){
            $diary_info["$i"]['content']=strip_tags($diary_info["$i"]['content']);
        }
        $this->assign('diary_info',$diary_info);
        $guest=D('Guestbook');
        $guest_info=$guest->order('id desc')->limit(10)->select();
        $this->assign('guest_info',$guest_info);

        $link=M('Link');
        $link_info=$link->select();
        $this->assign('link_info',$link_info);
        $this->display();



    }


}